]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
polkitAgent: Inherit AuthenticationAgent from Shell.PolkitAuthenticationAgent
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Tue, 28 May 2019 20:58:35 +0000 (22:58 +0200)
committerFlorian Müllner <florian.muellner@gmail.com>
Fri, 8 Nov 2019 23:12:47 +0000 (23:12 +0000)
AuthenticationAgent is just a wrapper of Shell's PolkitAuthenticationAgent, so
instead of using composition we can simply extend the base GObject.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/563

js/ui/components/polkitAgent.js

index 8759400ef3b183dcdc184cc147590e25fbe4d52c..b7321a0a158a2ecb3abc01cefcf209e057d78d2e 100644 (file)
@@ -369,19 +369,20 @@ var AuthenticationDialog = GObject.registerClass({
     }
 });
 
-var AuthenticationAgent = class {
-    constructor() {
+var AuthenticationAgent = GObject.registerClass(
+class AuthenticationAgent extends Shell.PolkitAuthenticationAgent {
+    _init() {
+        super._init();
+
         this._currentDialog = null;
-        this._handle = null;
-        this._native = new Shell.PolkitAuthenticationAgent();
-        this._native.connect('initiate', this._onInitiate.bind(this));
-        this._native.connect('cancel', this._onCancel.bind(this));
+        this.connect('initiate', this._onInitiate.bind(this));
+        this.connect('cancel', this._onCancel.bind(this));
         this._sessionUpdatedId = 0;
     }
 
     enable() {
         try {
-            this._native.register();
+            this.register();
         } catch (e) {
             log('Failed to register AuthenticationAgent');
         }
@@ -389,7 +390,7 @@ var AuthenticationAgent = class {
 
     disable() {
         try {
-            this._native.unregister();
+            this.unregister();
         } catch (e) {
             log('Failed to unregister AuthenticationAgent');
         }
@@ -439,8 +440,8 @@ var AuthenticationAgent = class {
             Main.sessionMode.disconnect(this._sessionUpdatedId);
         this._sessionUpdatedId = 0;
 
-        this._native.complete(dismissed);
+        this.complete(dismissed);
     }
-};
+});
 
 var Component = AuthenticationAgent;